def user(): return dict(form=auth())
def index():
    if auth.is_logged_in():
        flash = "%s %s %s" % (T('Welcome'), auth.user.first_name, auth.user.last_name)
        message = DIV(H1(T('RPXAuth Authentication')),     \
                  A(T('Profile'),_href=URL(r=request,f='user',args=['profile'])),  \
                  BR(),A(T('Change password'),_href=URL(r=request,f='user',args=['change_password'])),    \
                  BR(),A(T('Groups'),_href=URL(r=request,f='user',args=['groups'])),    \
                  BR(),A(T('Groups'),_href=URL(r=request,f='user',args=['groups'])),    \
                  BR(),A(T('New login'),_href=URL(r=request,f='user',args=['login'])),  \
                  BR(),A(T('Logout'),_href=URL(r=request,f='user',args=['logout'])))
        try:
            flash = "%s (id: %s)" % (flash, auth.userprofile.identifier)
        except:
            pass
    else:
        flash = T('Welcome to web2py')
        message = DIV(H1(T('RPXAuth Authentication')),     \
                  A(T('login'),_href=URL(r=request,f='user',args=['login'])),  \
                  BR(),A(T('Register (new user)'),_href=URL(r=request,f='user',args=['register'])),    \
                  BR(),A(T('login using password'),_href=URL(r=request,f='user',args=['passwd_login'])),    \
                  BR(),A(T('Retrieve password'),_href=URL(r=request,f='user',args=['retrieve_password']))) 


    response.flash=flash
    return dict(message=message)


## uncomment the following if you have defined "auth" and "crud" in models
# def data(): return dict(form=crud())
# def download(): return response.download(request,db)
## tip: use @auth.requires_login, requires_membership, requires_permission
